package com.lovo.project.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lovo.project.bean.DataBean;
import com.lovo.project.bean.SaleInGoodsBean;
import com.lovo.project.service.SaleInGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/saleingoods")
public class SaleInGoodsController {
    @Autowired
    SaleInGoodsService saleInGoodsService;

    @RequestMapping("/querySaleInGoodsList")
    public List<SaleInGoodsBean> querySaleInGoodsList(Integer saleInId){
        QueryWrapper queryWrapper=new QueryWrapper();
        queryWrapper.eq("salein_id",saleInId);
        List<SaleInGoodsBean> list=saleInGoodsService.querySaleInGoodsList(queryWrapper);
        return list;
    }

    @RequestMapping("/queryDate")
    public List<DataBean> queryDate(LocalDate startTime,LocalDate endTime){
        List<DataBean> list =saleInGoodsService.queryData(startTime,endTime);
        return list;
    }
}
